package com.jiawa.train.${module}.controller.admin;

import com.jiawa.train.common.resp.PageResult;
import com.jiawa.train.common.resp.Result;
import com.jiawa.train.${module}.req.${Domain}QueryReq;
import com.jiawa.train.${module}.req.${Domain}SaveReq;
import com.jiawa.train.${module}.service.${Domain}Service;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/${domain}")
@Slf4j
public class ${Domain}AdminController {

    @Resource
    private ${Domain}Service ${domain}Service;
    @PostMapping("/save")
    public Result save(@RequestBody @Valid ${Domain}SaveReq req) {
        ${domain}Service.save(req);
        return Result.success();
    }
    @GetMapping("/page")
    public Result<PageResult> query${Domain}List(${Domain}QueryReq  req) {
       PageResult pageResult = ${domain}Service.query${Domain}List(req);
       return Result.success(pageResult);
    }
    @DeleteMapping("/delete/{id}")
    public Result delete(@PathVariable Long id) {
        ${domain}Service.delete(id);
        return Result.success();
    }
}

